package com.yc.Matrix.group;

public class GroupMultipilerTask implements Runnable{

    private final double[][] result;  //final:确保线程安全性
    private final double[][] matrix1;
    private final double[][] matrix2;

    //行的范围
    private final int startIndex; // 起始行
    private final int endIndex; //终止行

    public GroupMultipilerTask(double[][] result, double[][] matrix1, double[][] matrix2, int startIndex, int endIndex) {
        this.result = result;
        this.matrix1 = matrix1;
        this.matrix2 = matrix2;
        this.startIndex = startIndex;
        this.endIndex = endIndex;
    }


    @Override
    public void run(){
        for(int i=startIndex;i<endIndex;i++){
            for(int j=0;j<matrix2[0].length;j++){
                result[i][j]=0;
                for(int k=0;k<matrix1[i].length;k++){
                    result[i][j]+=matrix1[i][k]*matrix2[k][j];
                }
                //放到Runnable中的run()中
                //参数： 结果矩阵，矩阵1 ， 矩阵2， 结果矩阵的第i行，第j列
            }
        }

    }
}
